#include "stdafx.h"
#include "CoreSettings.h"

bool CCoreSettings::load(const char* filename)
{
	CConfigReader file;
	if(!file.load(filename))
		return false;

	Database.Host = file.getValueString("MySQL", "host", "127.0.0.1");
	Database.Port = file.getValueInt("MySQL", "port", 3306);
	Database.Database = file.getValueString("MySQL", "dbname", "DevOnServer");
	Database.User = file.getValueString("MySQL", "user", "root");
	Database.Password = file.getValueString("MySQL", "password", "1234");

	Auth.NeuzVersion = file.getValueString("Auth", "neuzVersion", "20100412");
	Auth.Port = file.getValueInt("Auth", "port", 23000);

	char buffer[256];
	sprintf(buffer, "DevOnServer v%u.%u", Version, SubVersion);
	ISC.ServerName = file.getValueString("Char", "serverName", buffer);
	ISC.ServerIP = file.getValueString("Char", "IP", "127.0.0.1");
	ISC.Port = file.getValueInt("ISC", "port", 27097);
	ISC.Password = file.getValueString("ISC", "password", "1234");
	ISC.MaxChannels = file.getValueInt("ISC", "maxChannels", 1);

	Char.Port = file.getValueInt("Char", "port", 28000);

	return true;
}